﻿using System;
using System.Linq;
using System.Windows;

namespace BigMailer
{
	public partial class UrlWindow : Window
	{
		public UrlWindow()
		{
			InitializeComponent();
		}

		public string Url
		{
			get { return textBoxUrl.Text.Trim(); }
			set { textBoxUrl.Text = value; }
		}

		public string UserName
		{
			get { return tbUser.Text.Trim(); }
			set { tbUser.Text = value; }
		}

		public string Password
		{
			get { return tbPassword.Text.Trim(); }
			set { tbPassword.Text = value; }
		}

		private void buttonOK_Click(object sender, RoutedEventArgs e)
		{
			if ( Url.Length > 0 )
			{
				this.DialogResult = true;
				this.Close();
			}
		}

		private void buttonCancel_Click(object sender, RoutedEventArgs e)
		{
			this.DialogResult = false;
		}

		private void Window_Loaded(object sender, RoutedEventArgs e)
		{
			textBoxUrl.Focus();
		}

		private void linkGetHost_Click(object sender, RoutedEventArgs e)
		{
			UiCore.SaveHostCode();
		}
	}
}